import request from '@/utils/request'


export function fetchList(params) {
  return request({
    url: 'data/storage/list',
    method: 'get',
    params
  })
}

export function fetchDetail(params) {
  return request({
    url: 'data/storage/list/' + params.id,
    method: 'get',
    params
  })
}

export function fetchEchartDetail(params) {
  return request({
    url: 'data/storage/chartList/' + params.id,
    method: 'get',
    params
  })
}

export function fetchUploadStep1(params) {
  return request({
    url: 'receive/upload/step1',
    method: 'post',
    params
  })
}

export function fetchUploadStep2(data) {
  return request({
    url: 'receive/upload/step2',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: {
      type: 2,
      data: data
    }
  })
}

export function fetchVirusStep2(data) {
  return request({
    url: 'receive/virus/upload/step2',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: {
      type: 2,
      data: data
    }
  })
}

export function fetchAffinityStep2(data) {
  return request({
    url: 'receive/affinity/upload/step2',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: {
      type: 2,
      data: data
    }
  })
}

export function fetchUploadExl(data) {
  return request({
    url: `receive/generate/excel/${data.uuid}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: {
      type: 2,
      data: data
    }
  })
}

export function fetchHistoryList(params) {
  return request({
    url: `user/receive/history`,
    method: 'get',
    params
  })
}

export function fetchHistoryDetail(params) {
  return request({
    url: `user/receive/history/${params.id}`,
    method: 'get'
  })
}

export function fetchIntegration(data) {
  return request({
    url: `receive/integration`,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: {
      type: 2,
      data: data
    }
  })
}


export function fetchUploadFileApi(data) {
  return request({
    url: `receive/virus/upload/step1`,
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    },
    data
  })
}

export function fetchPackageApi(data) {
  return request({
    url: `user/package/list/${data.locale}`,
    method: 'get'
  })
}

